//
//  CartoonCollectionTableViewCell.m
//  Cartoon
//
//  Created by dllo on 15/10/29.
//  Copyright © 2015年 YSZ. All rights reserved.
//

#import "CartoonCollectionTableViewCell.h"

@implementation CartoonCollectionTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        self.continueLookButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
        [_continueLookButton addTarget:self action:@selector(buttonAction:) forControlEvents:UIControlEventTouchUpInside];
        
        self.myButtonLabel = [[UILabel alloc] init];
        self.myImageView = [[UIImageView alloc] init];
        self.myNameLabel = [[UILabel alloc] init];
        self.myAuthorLabel = [[UILabel alloc] init];
        self.myUpdateLabel = [[UILabel alloc] init];
        self.starts = [[StarView alloc] init];
        self.starts.starNum = self.starNum;
        self.myStartNumLabel = [[UILabel alloc] init];
        [self.contentView addSubview:_myButtonLabel];
        [self.contentView addSubview:_continueLookButton];
        [self.contentView addSubview:_myAuthorLabel];
        [self.contentView addSubview:_myImageView];
        [self.contentView addSubview:_myNameLabel];
        [self.contentView addSubview:_myStartNumLabel];
        [self.contentView addSubview:_myUpdateLabel];
//        [self.contentView addSubview:_starts];
        
    }
    return self;
}
- (void)layoutSubviews
{
    [super layoutSubviews];
    CGFloat height = self.bounds.size.height;
    CGFloat width = self.bounds.size.width;
    self.myImageView.frame = CGRectMake(10, 10, height - 20, height - 20);
    
//    self.myAuthorLabel.frame = CGRectMake(self.myImageView.frame.size.width + 20, 20, width - self.myImageView.frame.size.width + 20 - 80, 20);
    
    self.myNameLabel.frame = CGRectMake(self.myImageView.frame.size.width + 20, 20, width - height - 100, height - 40);
    
//    self.myUpdateLabel.frame = CGRectMake(self.myImageView.frame.size.width + 20, self.myAuthorLabel.frame.origin.y + 20 + 10 + 5, self.myAuthorLabel.frame.size.width, 15);
    
//    self.starts.frame = CGRectMake(self.myImageView.frame.size.width + 20, self.myAuthorLabel.frame.origin.y + 20 + 10 + 10 + 10, 50, 15);
//    
//    self.myStartNumLabel.frame = CGRectMake(self.starts.frame.origin.x + self.starts.frame.size.width, self.starts.frame.origin.y, 30, 15);
    
    self.continueLookButton.frame = CGRectMake(width - 100, 0, 100, height);
    
//    self.myButtonLabel.frame = CGRectMake(width - 80 - 5, height / 3 * 2, height / 3 / 1.5 + 10, 15);
    
    [self.continueLookButton setTitle:@"续读" forState:UIControlStateNormal];
    
//    self.myUpdateLabel.font = [UIFont systemFontOfSize:12];
    self.myNameLabel.font = [UIFont systemFontOfSize:20];
//    self.myStartNumLabel.font = [UIFont systemFontOfSize:12];
//    self.myButtonLabel.font = [UIFont systemFontOfSize:15];
//    self.starts.starNum = self.starNum;
}
- (void)buttonAction:(UIButton *)btn
{
    [self.delegate continueLookButtonAction:btn  cell:self];
}
- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    
    // Configure the view for the selected state
}

@end
